package com.xb.cloud.product.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.xb.cloud.product.service.business.model.mapper.AddressMapper;
import com.xb.cloud.product.service.business.model.mapper.BaseAreaMapper;
import com.xb.cloud.product.service.business.model.mapper.BaseCityMapper;
import com.xb.cloud.product.service.business.model.mapper.BaseCountyMapper;
import com.xb.cloud.product.service.business.model.mapper.BaseProvinceMapper;
import com.xb.cloud.product.service.client.SystemAddressService;
import com.xb.cloud.product.service.client.bo.BaseAddressBo;
import com.xb.cloud.service.client.ServiceReturnInfo;
import com.xb.cloud.service.client.ServiceReturnUtils;

@Service
public class SystemAddressServiceImpl implements SystemAddressService {
	@Resource
	BaseProvinceMapper baseProvinceMapper;

	@Resource
	BaseCityMapper baseCityMapper;

	@Resource
	BaseCountyMapper baseCountyMapper;

	@Resource
	BaseAreaMapper baseAreaMapper;

	@Resource
	AddressMapper addressMapper;

	@Override
	public ServiceReturnInfo getProvinces(Long companyId) {
		List<BaseAddressBo> provinces = addressMapper.getProvinces(companyId);
		return ServiceReturnUtils.success(provinces);
	}

	@Override
	public ServiceReturnInfo getCitys(Long provinceId) {
		List<BaseAddressBo> provinces = addressMapper.getCitys(provinceId);
		return ServiceReturnUtils.success(provinces);
	}

	@Override
	public ServiceReturnInfo getCountys(Long cityId) {
		List<BaseAddressBo> provinces = addressMapper.getCountys(cityId);
		return ServiceReturnUtils.success(provinces);
	}

	@Override
	public ServiceReturnInfo getAreas(Long countyId) {
		List<BaseAddressBo> provinces = addressMapper.getAreas(countyId);
		return ServiceReturnUtils.success(provinces);
	}

}
